<template>
  <div :style="style" @click="handleClick" :class="class">
    <i :class="`pi pi-spin pi-spinner ${iconStyle}`" v-if="showIcon" />
    <div v-else>
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const props = defineProps({
  style: Object,
  iconStyle: String,
  class: String
});

const showIcon = ref(false);

const handleClick = () => {
  showIcon.value = true;
  setTimeout(() => {
    showIcon.value = false;
  }, 2000);
};
</script>
